# 请安装 OpenAI SDK : pip install openai
# apiKey 获取地址： https://console.bce.baidu.com/iam/#/iam/apikey/list
# 支持的模型列表： https://cloud.baidu.com/doc/WENXINWORKSHOP/s/Fm2vrveyu

from openai import OpenAI
client = OpenAI(
    base_url='https://qianfan.baidubce.com/v2/images/generations',
    api_key='bce-v3/ALTAK-bfo0SBF3L6AzFj9DzuMUO/c6ade04d6bd597a4322e4436c115a11505192e96'
)
response = client.images.generate(
    model="irag-1.0", 
    prompt="一只兔子类型的宝可梦，低像素画风"
    '''extra_body={ 
        "refer_image":"your_refer_image_url(请上传图片)"
    }'''
)
print(response)